<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        
        .container {
            width: 200px;
            height: 100px;
            border: 1px solid #c00;
        }
        
        input[type="button"] {
            margin: 50px;
            border: none;
            width: 100px;
            height: 50px;
            background: green;
        }
    </style>
    <script>
        document.onmousemove = function(ev) {
            var e = ev || window.event;
            var div = document.getElementById("div");
            div.innerHTML =
                "clientX: " +
                e.clientX +
                ",clentY: " +
                e.clientY +
                "</br> screenX: " +
                e.screenX +
                ", screenY:" +
                e.screenY;
        };

        function test(ev) {
            var e = ev || window.event;
            var div1 = document.getElementById("div1");
            div1.innerHTML = "offsetX: " + e.offsetX + ",offsetY: " + e.offsetY;
        }
    </script>
</head>

<body>
    <span style="white-space: pre"> </span>
    <div id="div" class="container"></div>
    <span style="white-space: pre"> </span>
    <div id="div1" class="container"></div>
    <span style="white-space: pre"> </span
    ><input type="button" value="test" onclick="test();" />
  </body>
</html>